package lyq.spec.edu;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button button1 = (Button) findViewById(R.id.button1);
        Button button2 = (Button) findViewById(R.id.button2);
        Button button3 = (Button) findViewById(R.id.button3);
        button1. setOnClickListener(l);
        button2. setOnClickListener(l);
        button3. setOnClickListener(l);
    }
    private View.OnClickListener l =new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v.getId()==R.id.button1)
            {
                Intent intent=new Intent();
                intent.setClass(MainActivity.this,ActivityFirst.class);
                startActivity(intent);
            }
            else if(v.getId()==R.id.button2){
                Intent intent=new Intent();
                intent.setClass(MainActivity.this,ActivitySecond.class);
                startActivity(intent);
            }
            else{
                Intent intent=new Intent();
                intent.setClass(MainActivity.this,ActivityThird.class);
                startActivity(intent);
            }
        }
    };
}

